import random


def get_random_code():
    """ 随机生成一个6位数的验证码 """
    code = ''
    for i in range(6):
        num = random.randint(0, 9)
        code += str(num)

    return code


if __name__ == '__main__':
    print(get_random_code())
    code2 = ''.join(random.choices('0123456789', k=6))

    print(code2)
